#ifndef INCLUDE_TIMER_H
#define INCLUDE_TIMER_H

#include "GlobalData.h"

#include <list>




class Timer{
public:
	Timer();
	~Timer();

	void Set(unsigned int target_time); //set the timer
	int GetRemainingTime();	//returns the remaining ticks
	int Reset();			//set the timer back to its default time
	int Reset(unsigned int new_target_time);	//set the timer back to a new target time
	bool Arrived();		//reached the designated time

	void Deinitialize();	//set the timer's state to DEAD (for removal)
	static unsigned int GetTimerListSize();

	int Start();	//begin updating timer
	int Stop();		//stop updating the timer
	int Pause(unsigned int pause_time);	//pause timer for x amount of time

	static std::list<Timer*> timerList;	//list of all timers
	static Timer* GetTimer(int timer_number);
	static Timer* FactoryTimer();	//create a timer on the heap, push to list and return a pointer to it
	
	static void UpdateAllTimers();	//tick all timers

private:
	int targetTime; //starting time for the timer
	int ticks;		//current ticks
	FUNCTIONAL_STATE state;	//timer should be updating?
	bool Tick();		//update the timer
	
};

#endif